package com.aspose.cells;

import java.util.HashMap;

abstract class zabs {
   private static HashMap a = new HashMap();

   public static zagv a(String var0) {
      Object var1 = a.get(var0);
      if (var1 != null) {
         return (zagv)var1;
      } else {
         Object var2;
         if (var0.length() == 1) {
            var2 = new zabq(a(var0.charAt(0)));
         } else {
            String[] var3 = com.aspose.cells.b.a.zv.d(var0, '-');
            if (var3[2].length() != 1) {
               throw new CellsException(5, "Invalid parameter configuration: " + var0);
            }

            if (var3.length > 5) {
               var2 = new zabr(a(var3[2].charAt(0)), b(var3[3]), b(var3[4]), (byte)com.aspose.cells.b.a.zo.a(var3[0]), (byte)com.aspose.cells.b.a.zo.a(var3[1]), com.aspose.cells.b.a.zo.a(var3[5]));
            } else {
               if (var3[3].length() == 1 && var3[4].length() == 1) {
                  if (com.aspose.cells.b.a.zv.b(var3[0], var3[1])) {
                     return new zabo(a(var3[2].charAt(0)), a(var3[3].charAt(0)), a(var3[4].charAt(0)), (byte)com.aspose.cells.b.a.zo.a(var3[0]));
                  }

                  return new zabp(a(var3[2].charAt(0)), a(var3[3].charAt(0)), a(var3[4].charAt(0)), (byte)com.aspose.cells.b.a.zo.a(var3[0]), (byte)com.aspose.cells.b.a.zo.a(var3[1]));
               }

               var2 = a(com.aspose.cells.b.a.zo.a(var3[0]), com.aspose.cells.b.a.zo.a(var3[1]), a(var3[2].charAt(0)), b(var3[3]), b(var3[4]));
            }
         }

         a.put(var0, var2);
         return (zagv)var2;
      }
   }

   private static int a(char var0) {
      switch(var0) {
      case 'A':
         return 96;
      case 'R':
         return 32;
      case 'V':
         return 64;
      default:
         throw new CellsException(5, "Invalid parameter configuration");
      }
   }

   private static int[] b(String var0) {
      char[] var1 = var0.toCharArray();
      int[] var2 = new int[var1.length];

      for(int var3 = 0; var3 < var2.length; ++var3) {
         var2[var3] = a(var1[var3]);
      }

      return var2;
   }

   public static zagv a(int var0, int var1, int var2, int[] var3, int[] var4) {
      if (var0 == 0 && var1 == 0) {
         return new zabq(var2);
      } else if (var3.length == 1 && var4.length == 1) {
         return (zagv)(var0 == var1 ? new zabo(var2, var3[0], var4[0], (byte)var0) : new zabp(var2, var3[0], var4[0], (byte)var0, (byte)var1));
      } else {
         int var5;
         int var6;
         int[] var7;
         if (var3.length > 7) {
            var5 = var3[var3.length - 1];
            var6 = var3.length - 2;
            if (var3[var6] == var5) {
               --var6;

               while(var6 > 0 && var3[var6] == var5) {
                  --var6;
               }
            }

            var6 += 2;
            if (var6 > 7) {
               return new zabm(new zabt(var2, var3, var4), (byte)var0, (byte)var1);
            }

            var7 = new int[var6];
            System.arraycopy(var3, 0, var7, 0, var6);
            var3 = var7;
         }

         if (var4.length > 7) {
            var5 = var4[var4.length - 1];
            var6 = var4.length - 2;
            if (var4[var6] == var5) {
               --var6;

               while(var6 > 0 && var4[var6] == var5) {
                  --var6;
               }
            }

            var6 += 2;
            if (var6 > 7) {
               return new zabm(new zabt(var2, var3, var4), (byte)var0, (byte)var1);
            }

            var7 = new int[var6];
            System.arraycopy(var4, 0, var7, 0, var6);
            var4 = var7;
         }

         return (zagv)(var0 == var1 ? new zabo(var2, var3, var4, (byte)var0) : new zabp(var2, var3, var4, (byte)var0, (byte)var1));
      }
   }
}
